<!--
*Author：富行天下团队

 *代码由框架生成,任何更改都可能导致被代码生成器覆盖
 *业务请在@/extension/Food/Fproduct.js此处编写
 -->
<template>
  <div>
    <view-grid ref="grid" :columns="columns" :detail="detail" :editFormFields="editFormFields"
      :editFormFileds="editFormFields" :editFormOptions="editFormOptions"
      :searchFormFields="searchFormFields" :searchFormFileds="searchFormFields"
      :searchFormOptions="searchFormOptions" :table="table" :extend="extend">
    </view-grid>
  </div>
</template>

<script>
import extend from "@/extension/Food/Fproduct.js";
import ViewGrid from "@/components/basic/ViewGrid.vue";
var vueParam = {
  components: {
    ViewGrid,
  },
  data() {
    return {
      table: {
        key: "product_id",
        footer: "Foots",
        cnName: "商品列表",
        name: "Fproduct",
        url: "/Fproduct/",
        sortName: "product_id",
      },
      extend: extend,
      editFormFields: {
        supplierCode: "",
        product_status: "",
        limit_num: "",
        product_sort: "",
        sales_initial: "",
        product_name: "",
        selling_point: "",
        category_id: "",
        deduct_stock_type: "",
        product_unit: "",
        special_id: "",
        product_price: "",
        spec_type: "",
        bag_price: "",
        product_stock: "",
        content: "",
      },
      editFormOptions: [
        [
          {
            dataKey: "restaurants",
            data: [],
            title: "餐厅名称",
            required: true,
            field: "supplierCode",
            type: "select",
          },
          {
            title: "产品名称",
            required: true,
            field: "product_name",
            type: "text",
          },
          {
            field: "product_no",
            title: "产品编码",
            type: "text",
            require: true,
            disabled: true,
          },
          // {
          //   title: "产品分类id",
          //   required: true,
          //   field: "category_id",
          //   disabled: true,
          //   type: "text",
          // },
        ],
        [
          {
            dataKey: "",
            data: [
              { key: 10, value: "下单减库存" },
              { key: 20, value: "付款减库存" },
            ],
            title: "库存计算方式",
            field: "deduct_stock_type",
            type: "radio",
            disabled: true,
          },
          {
            dataKey: "",
            data: [
              { key: 0, value: "无" },
              { key: 1, value: "新品" },
              { key: 2, value: "热卖" },
            ],
            title: "特殊分类",
            field: "special_id",
            type: "radio",
          },
          {
            dataKey: "FoodProUnit",
            data: [],
            title: "产品单位",
            field: "product_unit",
            type: "select",
            disabled: true,
          },
        ],
        [
          // {
          //   dataKey: "",
          //   data: [
          //     { key: 10, value: "单规格" },
          //     { key: 20, value: "多规格" },
          //   ],
          //   title: "产品规格",
          //   field: "spec_type",
          //   type: "radio",
          //   disabled: true,
          // },
          { title: "产品一口价", field: "product_price", type: "text" },
          { title: "包装费", field: "bag_price", type: "text", disabled: true },
        ],
        [
          {
            title: "产品总库存",
            field: "product_stock",
            type: "text",
            disabled: true,
          },
          {
            title: "初始销量",
            field: "sales_initial",
            type: "text",
            disabled: true,
          },
          {
            title: "产品排序",
            field: "product_sort",
            type: "text",
            disabled: true,
          },
        ],
        [
          {
            title: "限购数量",
            field: "limit_num",
            type: "number",
            disabled: true,
          },
          {
            title: "产品状态",
            field: "product_status",
            type: "radio",
            dataKey: "",
            data: [
              { key: 10, value: "上架" },
              { key: 20, value: "下架" },
            ],
          },
          {
            title: "产品卖点",
            field: "selling_point",
            type: "text",
            disabled: true,
          },
        ],
        [
          {
            title: "产品规格",
            field: "content",
            type: "editor",
          },
        ],
        [{ title: "产品详情", field: "content", type: "editor", colSize: 12 }],
      ],
      searchFormFields: {
        product_name: "",
        product_status: "",
        supplierCode: "",
      },
      searchFormOptions: [
        [
          { title: "产品名称", field: "product_name", type: "like" },
          {
            title: "产品状态",
            field: "product_status",
            type: "select",
            dataKey: "",
            data: [
              { key: 10, value: "上架" },
              { key: 20, value: "下架" },
            ],
          },
          {
            title: "餐厅名称",
            field: "supplierCode",
            type: "select",
            dataKey: "restaurants",
          },
        ],
      ],
      columns: [
        {
          field: "product_id",
          title: "产品id",
          type: "int",
          width: 90,
          hidden: true,
          readonly: true,
          require: true,
          align: "left",
        },
        {
          title: "餐厅名称",
          required: true,
          field: "supplierCode",
          type: "string",
          bind: { key: "restaurants", data: [] },
        },
        {
          field: "product_name",
          title: "产品名称",
          type: "string",
          width: 220,
          require: true,
          align: "left",
          sortable: true,
        },
        {
          field: "product_price",
          title: "产品一口价",
          type: "decimal",
          width: 90,
          align: "left",
        },
        {
          field: "line_price",
          title: "产品划线价",
          type: "decimal",
          width: 90,
          align: "left",
        },
        {
          field: "product_no",
          title: "产品编码",
          type: "string",
          width: 120,
          require: true,
          align: "left",
        },
        {
          field: "product_status",
          title: "产品状态",
          type: "int",
          width: 90,
          align: "left",
          bind: {
            key: "",
            data: [
              { key: 10, value: "上架" },
              { key: 20, value: "下架" },
            ],
          },
        },
        {
          field: "product_unit",
          title: "产品单位",
          type: "string",
          bind: { key: "FoodProUnit", data: [] },
          width: 90,
          align: "left",
        },
        {
          field: "product_stock",
          title: "产品总库存",
          type: "int",
          width: 90,
          align: "left",
        },
        {
          field: "selling_point",
          title: "产品卖点",
          type: "string",
          width: 220,
          align: "left",
        },
        {
          field: "product_sort",
          title: "产品排序",
          type: "int",
          width: 90,
          align: "left",
        },
        {
          field: "category_id",
          title: "产品分类id",
          type: "int",
          width: 90,
          hidden: true,
          readonly: true,
          require: true,
          align: "left",
        },
        {
          field: "spec_type",
          title: "产品规格",
          type: "int",
          bind: {
            key: "",
            data: [
              { key: 10, value: "单规格" },
              { key: 20, value: "多规格" },
            ],
          },
          width: 90,
          align: "left",
        },
        {
          field: "deduct_stock_type",
          title: "库存计算方式",
          type: "sbyte",
          bind: {
            key: "",
            data: [
              { key: 10, value: "下单减库存" },
              { key: 20, value: "付款减库存" },
            ],
          },
          width: 90,
          align: "left",
        },
        {
          field: "content",
          title: "产品详情",
          type: "string",
          width: 90,
          align: "left",
        },
        {
          field: "sales_initial",
          title: "初始销量",
          type: "int",
          width: 90,
          align: "left",
        },
        {
          field: "sales_actual",
          title: "实际销量",
          type: "int",
          width: 90,
          align: "left",
        },

        {
          field: "is_points_gift",
          title: "是否开启积分赠送(1开启 0关闭)",
          type: "int",
          width: 90,
          align: "left",
        },
        {
          field: "is_points_discount",
          title: "是否允许使用积分抵扣(1允许 0不允许)",
          type: "int",
          width: 90,
          align: "left",
        },
        {
          field: "max_points_discount",
          title: "最大积分抵扣数量",
          type: "int",
          width: 90,
          align: "left",
        },
        {
          field: "is_enable_grade",
          title: "是否开启会员折扣(1开启 0关闭)",
          type: "int",
          width: 90,
          align: "left",
        },
        {
          field: "is_alone_grade",
          title: "会员折扣设置(0默认等级折扣 1单独设置折扣)",
          type: "int",
          width: 90,
          align: "left",
        },
        {
          field: "alone_grade_equity",
          title: "单独设置折扣的配置",
          type: "string",
          width: 90,
          align: "left",
        },
        {
          field: "alone_grade_type",
          title: "折扣金额类型(10百分比 20固定金额)",
          type: "int",
          width: 90,
          align: "left",
        },
        {
          field: "is_agent",
          title: "是否参加分销0否1是",
          type: "int",
          width: 90,
          align: "left",
        },
        {
          field: "is_ind_agent",
          title: "是否开启单独分销(0关闭 1开启)",
          type: "int",
          width: 90,
          align: "left",
        },
        {
          field: "agent_money_type",
          title: "分销佣金类型(10百分比 20固定金额)",
          type: "int",
          width: 90,
          align: "left",
        },
        {
          field: "first_money",
          title: "分销佣金(一级)",
          type: "decimal",
          width: 90,
          align: "left",
        },
        {
          field: "second_money",
          title: "分销佣金(二级)",
          type: "decimal",
          width: 90,
          align: "left",
        },
        {
          field: "third_money",
          title: "分销佣金(三级)",
          type: "decimal",
          width: 90,
          align: "left",
        },

        {
          field: "view_times",
          title: "访问次数",
          type: "int",
          width: 90,
          align: "left",
        },

        // {
        //   field: "shop_supplier_id",
        //   title: "供应商id",
        //   type: "int",
        //   width: 90,
        //   align: "left",
        // },
        {
          field: "supplier_price",
          title: "供应商价格",
          type: "decimal",
          width: 90,
          align: "left",
        },
        {
          field: "limit_num",
          title: "限购数量0为不限",
          type: "int",
          width: 90,
          align: "left",
        },
        {
          field: "grade_ids",
          title: "可购买会员等级id，逗号隔开",
          type: "string",
          width: 180,
          align: "left",
        },
        {
          field: "product_type",
          title: "0外卖1店内",
          type: "int",
          width: 90,
          align: "left",
        },

        {
          field: "product_attr",
          title: "产品属性",
          type: "string",
          width: 90,
          align: "left",
        },
        {
          field: "product_feed",
          title: "售卖加料",
          type: "string",
          width: 90,
          align: "left",
        },
        {
          field: "special_id",
          title: "特殊分类id",
          type: "int",
          bind: {
            key: "",
            data: [
              { key: 0, value: "无" },
              { key: 1, value: "新品" },
              { key: 2, value: "热卖" },
            ],
          },
          width: 90,
          align: "left",
        },
        {
          field: "cost_price",
          title: "成本价",
          type: "decimal",
          width: 90,
          align: "left",
        },
        {
          field: "min_buy",
          title: "最小购买量",
          type: "int",
          width: 90,
          align: "left",
        },
        {
          field: "bag_price",
          title: "包装费",
          type: "decimal",
          width: 90,
          align: "left",
        },
        {
          field: "is_delete",
          title: "是否删除",
          type: "int",
          width: 90,
          align: "left",
        },
        {
          field: "app_id",
          title: "应用id",
          type: "int",
          width: 90,
          align: "left",
        },

        //  {field:'merchantName',title:'商户名称',type:'string',width:120,align:'left'},
        //  {field:'merchantCode',title:'商户编码',type:'string',width:120,align:'left'},
        {
          field: "creator",
          title: "创建人",
          type: "string",
          width: 80,
          align: "left",
        },
        {
          field: "createDate",
          title: "创建时间",
          type: "datetime",
          width: 190,
          align: "left",
          sortable: true,
        },
        {
          field: "modifier",
          title: "修改人",
          type: "string",
          width: 80,
          align: "left",
        },
        {
          field: "modifyDate",
          title: "修改时间",
          type: "datetime",
          width: 190,
          align: "left",
          sortable: true,
        },
      ],
      detail: {
        cnName: "#detailCnName",
        columns: [],
        sortName: "",
        key: "",
      },
    };
  },
};
export default vueParam;
</script>
